faApp.controller('OrderPhoUploadCtrl',['$scope','orderPhoService','$location','$controller','$route','$routeParams',function($scope,orderPhoService,$location,$controller,$route,$routeParams) {   
  $controller('BaseCtrl', {$scope: $scope}); 

  $scope.proOrder={oLocation:''};

  $scope.config = {};
  $scope.config.pType=$routeParams.pType;//05私募
  $scope.config.pId=$routeParams.pId;
  $scope.config.oId=$routeParams.oId;
  $scope.config.oType=$routeParams.oType;//03私募
  orderPhoService.query($scope.config).then(function(json){
    $scope.list=json.list;
    $scope.proOrder.oLocation = json.oLocation;
    //alert($scope.proOrder.oLocation);
    console.log("query phoupload end");
    $scope.loading=false;
  });

$scope.picAddres = [];
$scope.orderPhosStatus = [];
$scope.onUploadFile({
    showMessage : function(m){ alert(m); },
    onComplete:function(f,response,id){
      id--;
      if (response.statusCode == "0000") {
        $scope.picAddres[id] =response.attribute.fileUrl;//App.staticHost + 
        $scope.$apply();
      } else { 
        alert('上传失败'); 
      }
    }    
});


$scope.save=function(){
  if (!$scope.form.$invalid){
    $scope.proOrder.orderPhos=$scope.picAddres.join(",");
    $scope.proOrder.orderPhosStatus=$scope.orderPhosStatus.join(",");
    $scope.proOrder.oId=$scope.config.oId;
    $scope.proOrder.pId=$scope.config.pId;
    $scope.proOrder.pType=$scope.config.pType;
    $scope.proOrder.oType=$scope.config.oType;

    orderPhoService.add($scope.proOrder).then(function(json){
      if(!json.statusCode){
        alert("上传成功");
        $route.reload();
      }else{
        alert("上传失败!!!"+json.statusCode);
      }
    })
  }else{
    alert("还有图片未上传");
  }
}

}]);


faApp.controller('OrderPEVCPhoUploadCtrl',['$scope','orderPhoService','$location','$controller','$route','$routeParams',function($scope,orderPhoService,$location,$controller,$route,$routeParams) {   
  $controller('BaseCtrl', {$scope: $scope}); 
  
$scope.proOrder={oLocation:''};
  $scope.config = {};
  $scope.config.pType=$routeParams.pType;
  $scope.config.pId=$routeParams.pId;
  $scope.config.oId=$routeParams.oId;
  $scope.config.oType=$routeParams.oType;
  $scope.k=$routeParams.k;
  $scope.role=$routeParams.role;
  $scope.head=$routeParams.head;
  orderPhoService.query($scope.config).then(function(json){
    $scope.list=json.list;
     $scope.proOrder.oLocation = json.oLocation;
     console.log("query PEVCphoupload end");
    $scope.loading=false;
  });
$scope.picAddres = [];
$scope.orderPhosStatus = [];

$scope.onUploadFile({
    showMessage : function(m){ alert(m); },
    onComplete:function(f,response,id){
      id--;
      if (response.statusCode == "0000") {
        $scope.picAddres[id] =response.attribute.fileUrl;//App.staticHost + 
        $scope.$apply();
      } else { 
        alert('上传失败'); 
      }
    }    
});


$scope.save=function(){

    $scope.proOrder.orderPhos=$scope.picAddres.join(",");
    $scope.proOrder.orderPhosStatus=$scope.orderPhosStatus.join(",");
    $scope.proOrder.oId=$scope.config.oId;
    $scope.proOrder.pId=$scope.config.pId;
    $scope.proOrder.pType=$scope.config.pType;
    $scope.proOrder.oType=$scope.config.oType;
    orderPhoService.addPEVC($scope.proOrder).then(function(json){
      if(!json.statusCode){
        alert("上传成功");
        $route.reload();
      }else{
        alert("上传失败!!!"+json.statusCode);
      }
    })
 
}

}]);